import { Tabbar } from 'vant'
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    condition:"",
    category:"",
    fq:"",
    tingDis:0,
    homenav:0,
    catedis:0,
  },
  mutations: {
    changeCondition(state,val){
      state.condition = val
    },
    changeFq(state,val){
      state.fq = val
    },
    
    saveTingDis(state,val){
      state.tingDis = val

    },

    saveHomenav(state,val){
      state.homenav = val

      window.localStorage.setItem('homenav',state.homenav)
    },
    saveCateDis(state,val){
      state.catedis = val

      window.localStorage.setItem('catedis',state.catedis)
    }
     

  
  },
  getters:{
    // saveTingDis(state){
    //   return state.tingDis
    // },
    
    getHomenav(state){
      if(state.homenav){
        return state.homenav
      }else{
        state.homenav = window.localStorage.getItem('homenav')
        return state.homenav - 0
      }
    }

  },
  actions: {
  },
  modules: {
  }
})
